//=============================================================================
// FloorSentinel - Latches on to the floor and shoots at things.
//=============================================================================
class FloorSentinel extends Sentinel
	placeable;

simulated function bool AllowUpgrade(class<SentinelUpgrade> NewUpgradeClass,pawn user, optional float cost)
{
	if(!NewUpgradeClass.Default.bFitsFloor)
		return false;

	return Super.AllowUpgrade(NewUpgradeClass,user,cost);
}

simulated event Destroyed()
{
    local int i,upgrade_limits;
    local float lcost;
    local string leftS, rightS;
    local bool repeat;
    local int Checklimit;

    upgrade_limits = 9;
    i=0;
    Checklimit = 6;

    if(Upgrade != None)
    {
        while(i<upgrade_limits)
        {
        if(CheckUpgrades(class 'TFMenuConsole'.default.SentinelUpgrade[i])==true)
            {
	        divide(class 'TFMenuConsole'.default.SentinelUOption[i]," ",lefts,rightS);
            if(lefts=="") lcost=0;
            else lcost=float(lefts);
            if(level.game != none) tfgri(level.game.gamereplicationinfo).control[myteam]-=lcost;
            }
         i++;
         }
         i=0;lcost=0;
         while(i<Checklimit && repeat==false)
         {
          if(CheckUpgrades(class 'TFMenuConsole'.default.SentinelTurret[i])==true)
          {
 			divide(class 'TFMenuConsole'.default.SentinelTOption[i]," ",lefts,rightS);
 			if(lefts=="") lcost=0;
 			else lcost=float(lefts);
            if(level.game != none) tfgri(level.game.gamereplicationinfo).control[myteam]-=lcost;
 			repeat=true;
          }
		i++;
      	}
     }
	Super.Destroyed();
}

defaultproperties
{
     YawSpeed=20000.000000
     PitchSpeed=20000.000000
     AimAhead=0.800000
     HearingAdjustment=-0.500000
     TeamMarkerOffset=(Z=32.000000)
     DefaultWeaponClass=Class'taskforces.SentinelPulse'
     DefaultWeap="taskforces.SentinelPulse"
     CentreOffset=(Z=-4.000000)
     HearingThreshold=3000.000000
     SightRadius=7000.000000
     BaseEyeHeight=16.000000
     EyeHeight=16.000000
     Physics=PHYS_Falling
     PrePivot=(Z=-32.000000)
     Skins(0)=Shader'TFMedia.Cannons.FloorCannonShader'
     Sname="Turret Sentinel"
     refControl=150
}
